﻿namespace Sidvall.CodeGenerator
{
    public class DomainObjectPropertyMappingCollection : System.Collections.ObjectModel.KeyedCollection<string, DomainObjectPropertyMapping>
    {
        #region Public Members

        #region Add

        public void Add(DomainObjectProperty property, string propertyFullName)
        {
            var item = new DomainObjectPropertyMapping()
            {
                Property = property,
                PropertyFullName = propertyFullName,
            };
            Add(item);
        }

        #endregion
        #region GetKeyForItem

        protected override string GetKeyForItem(DomainObjectPropertyMapping item)
        {
            if (item == null)
                throw new System.ArgumentNullException("item");
            return item.PropertyFullName;
        }

        #endregion

        #endregion
        #region Constructors

        public DomainObjectPropertyMappingCollection()
            : base(System.StringComparer.OrdinalIgnoreCase)
        {
        }

        #endregion
    }
}
